package cn.csdj.sism.service.impl;

import cn.csdj.sism.dao.RoleMapper;
import cn.csdj.sism.pojo.Class;
import cn.csdj.sism.pojo.Role;
import cn.csdj.sism.service.RoleService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
/**
 * @author 李心怡
 * 2023/4/10
 */
@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    private RoleMapper roleMapper;
    @Override
    public int insert(Role role) {
        return roleMapper.insert(role);
    }

    @Override
    public int deleteById(Integer id) {
        return roleMapper.deleteById(id);
    }

    @Override
    public int update(Role role) {
        return roleMapper.updateById(role);
    }

    @Override
    public Role selectById(Integer id) {
        return roleMapper.selectById(id);
    }

    @Override
    public List<Role> selectAll() {
        return roleMapper.selectList(null);
    }

    @Override
    public IPage<Role> selectPages(Integer current, Integer pageSize) {
        //        Page(当前页码，页面大小);
        IPage<Role> page = new Page(current,pageSize);
        roleMapper.selectPage(page,null);
        return page;//返回数据

    }
}
